<?php
namespace app\mxty\logic;

use app\mxty\model\Coach as CoachModel;

use app\api\service\User as UserService;

class Coach
{
    public static function isCoach()
    {
      // 获取当前请求的用户id
      $user_id = UserService::getCurrentLoginUserId();
      $coach = (new CoachModel)->findEmployeeByUserId($user_id);
      if($coach->isEmpty()) {
        return false;
      }

      return true;
    }

    public static function getCoachIdByUserId($user_id)
    {
      $coachs = (new CoachModel)->selectIdsByUserId($user_id);
      return $coachs->toArray();
    }
}
